<cfset BASE = CreateObject("component", "cfc.base") / >
<cfset statusQueries = CreateObject("component", "cfc.statusQueries") />
<cfset baseQueries = CreateObject("component", "cfc.queries") />

<cfset qryGetStep5Waiting = statusQueries.funcGetSCFStepWaiting(6) />

	<cfdocument format="pdf" orientation="landscape" filename="Temp/Finance.pdf" overwrite="yes">
            <div class="post">
                <div class="entry">
                	<div clase="report">
                		<h1 class="title">Finance Creation Report</h1>
	<cfoutput>	
        <cfset intX = 1>
        <cfset GAP = 15>
        <cfif qryGetStep5Waiting.recordcount GT 0>
            <table width = 100%>
                <tr>
                    <td>&nbsp;</td> 
                </tr>
                <tr> 
                    <td valign="bottom"><u>##</u></td> 
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom">
                        <strong><u>Name</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom">
                        <strong><u>Contact Info</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom" nowrap="nowrap">
                        <strong><u>Personal Info</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom">
                        <strong><u>Job Info</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom" nowrap="nowrap">
                        <strong><u>Pay Status</u></strong>
                    </td>
                    <td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom" nowrap="nowrap">
                        <strong><u>Time Card Approver(s)</u></strong>
                    </td>
                    <!---td width=#GAP#>&nbsp;</td> 
                    <td valign="bottom" nowrap="nowrap">
                        <strong><u>Emergency Contact</u></strong>
                    </td--->
                </tr>
                <cfloop query="qryGetStep5Waiting">     
                    <cfset intStepID = ID>   
                    <cfset strEmpName =  Name>               	
                    <cfquery name="qryGetEmpInfo" datasource="#Session.DataSource#">
                        scf_GetEmpInfoByStep #intStepID#
                    </cfquery>
                    <cfloop query="qryGetEmpInfo">
                        <cfset intEmpID = ID>
                        <cfif PreferredName EQ ''>
                            <cfset strEmpName = trim(Last & ', ' & First & ' ' & Middle)>
                        <cfelse>
                            <cfset strEmpName = trim(Last & ', ' & First & ' (' & PreferredName & ') ' & Middle )>
                        </cfif>
                        <cfset strAddr1 = Address1>
                        <cfset strAddr2 = Address2>
                        <cfset strCity = City>
                        <cfset intState = State>
                        <cfset strZIP = ZIP>
                        <cfset strEmail = Email>
                        <cfif PhonePrimaryID EQ 14>
                            <cfset strPhone = BASE.DisplayPhone(HomePhone)>
                        <cfelseif PhonePrimaryID EQ 19>
                            <cfset strPhone = BASE.DisplayPhone(CellPhone)>
                        <cfelse>
                            <cfif WorkPhoneExt NEQ ''>
                                <cfset strPhone = BASE.DisplayPhone(WorkPhone) & ' x' & WorkPhoneExt>
                            <cfelse>
                                <cfset strPhone = BASE.DisplayPhone(WorkPhone)>
                            </cfif>
                        </cfif>
                        <cfset dteDOB = dateformat(DOB, 'mm/dd/yyyy')>
                        <cfset dteDOH = dateformat(ActStartDate, 'mm/dd/yyyy')>
                        <cfset strSSN = SSN>
                        <cfset intDeptID = DeptID>
                        <cfset intSupID = SupervisorID>
                        <cfset arrTCAppr = listToArray(TimeCardApprs)>
                        <cfset intFreqID = FrequencyID>
                        <cfset fltPayRate = PayRate>
                        <cfset intSalaryHourlyID = SalaryHourlyID>
                        <cfset intHours = HoursPerWeek>
                        <cfset intCompTypeID = CompTypeID>
                        <cfset intGenderID = GenderID>
                        <cfset intBadgeID = BadgeID>    
                        <cfset intEmpCodeID = EmpCodeID>
                        <cfset intPosID = PositionID>
                        <cfset bolBenefits = Benifits>
                        <cfset bolLeave = Leave>
                        <cfset bolDaily = Daily>
                        <cfset strCostCode = CostCode>
                        <cfset strLunch = LunchType>
                        <cfset strShift = ShiftType>
                        <cfif bolDaily EQ 1>
                        	<cfset strDaily = "Daily">
                        <cfelse>
                        	<cfset strDaily = "Half-Daily">
                        </cfif>
                        <cfif bolLeave EQ 1>
                        	<cfset strLeave = "Yes">
                        <cfelse>
                        	<cfset strLeave = "No">
                        </cfif>
                        <cfif bolBenefits EQ 1>
                        	<cfset strBenefits = "Yes">
                        <cfelse>
                        	<cfset strBenefits = "No">
                        </cfif>
                    </cfloop>    
                        
                    <cfquery name="qryGetECInfo" datasource="#Session.DataSource#">
                        scf_GetEmpContactInfo #intEmpID#, 2
                    </cfquery>
                    <cfquery name="qryGetBeneficaryInfo" datasource="#Session.DataSource#">
                        scf_GetEmpContactInfo #intEmpID#, 1
                    </cfquery>
                    <cfset strECName = qryGetECInfo.First & ' ' & qryGetECInfo.Last>
                    <cfset strECAddr1 = qryGetECInfo.Address1>
                    <cfset strECAddr2 = qryGetECInfo.Address2>
                    <cfset strECCity = qryGetECInfo.City>
                    <cfset intECStateID = qryGetECInfo.State>
                    <cfset strECZIP = qryGetECInfo.ZIP>
                    <cfif qryGetECInfo.PhonePrimaryID EQ 14>
                        <cfset strECPhone = BASE.DisplayPhone(qryGetECInfo.HomePhone)>
                    <cfelseif qryGetECInfo.PhonePrimaryID EQ 19>
                        <cfset strECPhone = BASE.DisplayPhone(qryGetECInfo.CellPhone)>
                    <cfelse>
                        <cfif qryGetECInfo.WorkPhoneExt NEQ ''>
                            <cfset strECPhone = BASE.DisplayPhone(qryGetECInfo.WorkPhone) & ' x' & qryGetECInfo.WorkPhoneExt>
                        <cfelse>
                            <cfset strECPhone = BASE.DisplayPhone(qryGetECInfo.WorkPhone)>
                        </cfif>
                    </cfif>
                    
                    <cfquery name="qryGetFundwareInfo" datasource="#Session.DataSourceWFCDB#">
                        Select 
                            (Select PersonCode
                            From tSY_Person_Codes
                            Where PersonCodeIDNo = #intSalaryHourlyID#) as SalaryHourly,
                            (Select PersonCode
                            From tSY_Person_Codes
                            Where PersonCodeIDNo = #intGenderID#) as Gender,
                            (Select LocalCodeAbbreviation
                            From tLocal_Codes
                            Where LocalCodeIDNo = #intState#) as State,
                            <cfif intECStateID NEQ ''>
                            (Select LocalCodeAbbreviation
                            From tLocal_Codes
                            Where LocalCodeIDNo = #intECStateID#) as ECState,
                            </cfif>
                            (Select PayRateFrequencyCode
                            From tSY_Pay_Rate_Frequency_Codes
                            Where PayRateFrequencyCodeDomainIdNo = #intFreqID#) as Frequency,
                            (Select TypeCode
                            From tType_Codes
                            Where TypeCodeIDNo = #intCompTypeID#) as CompType,
                            (Select OrganizationDescription
                            From tOrganizations
                            Where OrgCodeIDNo = #intDeptID# and OrganizationToEffectDate = '1/1/3000') as Dept,
                            (Select EmploymentCode
                            From tEmployment_Codes
                            Where EmploymentCodeIDNo=#intEmpCodeID#) as EmploymentCode	                        
                    </cfquery>
					
                    <cfset strSH = qryGetFundwareInfo.SalaryHourly>
                    <cfset strGender = qryGetFundwareInfo.Gender>
                    <cfset strST = qryGetFundwareInfo.State>
                    <cfset strFreq = qryGetFundwareInfo.Frequency>
                    <cfset strCompType = qryGetFundwareInfo.CompType>
                    <cfset strDept = qryGetFundwareInfo.Dept>
                    <cfset strEmpCode = qryGetFundwareInfo.EmploymentCode>
                    <cfif isdefined("qryGetFundwareInfo.ECState")>
                    	<cfset strECST = qryGetFundwareInfo.ECState>
                    <cfelse>
                    	<cfset strECST = ''>
                    </cfif>
                    
                    <cfquery name="qryGetPositionInfo" datasource="#Session.DataSourceWFCDB#">
                        Select PositionIDNo, PositionCode, PositionCodeDescription
                        From tPosition_Codes 
                        Where PositionIdNo = #intPosID#
                    </cfquery>
					<cfset strPos = qryGetPositionInfo.PositionCodeDescription>
                                                   
                <tr> 
                    <td valign="top">#intX#)</td> 
                    <td>&nbsp;</td>  
                    <td nowrap="nowrap" valign="top">
                        #strEmpName#
                    </td>
                    <td>&nbsp;</td> 
                    <td nowrap="nowrap" valign="top">
                        #strAddr1#<BR />
                        <cfif strAddr2 NEQ ''>
                            strAddr2<BR />
                        </cfif>
                        #strCity#, #strST#&nbsp;&nbsp;#strZIP#<BR />
                        #strPhone#<BR />
                        #strEmail#
                    </td>
                    <td>&nbsp;</td> 
                    <td valign="top" nowrap="nowrap">
                        SSN: #strSSN#<BR />
                        Gender: #strGender#<BR />
                        Badge ##: #intBadgeID#  <br />
                        DOB: #dteDOB#<BR />
                        DOH: #dteDOH#                    
                    </td>
                    <td>&nbsp;</td>
                    <td nowrap="nowrap" valign="top">
                    	#strPos#<br />
                        #strDept#<br /> 
                        Lunch: #strLunch#  <br />  
                        Leave: #strLeave#  <br />  
                        Benefits: #strBenefits#                   
                    </td>
                    <td>&nbsp;</td> 
                    <td valign="top" nowrap="nowrap">
                        Pay Rate: $#fltPayRate# (#strFreq#)<BR />   
                        Cost Code: #strCostCode#<BR />
                        Hours Per Week: #intHours#<BR />
                        #strEmpCode#, #strSH# <BR />    
                        #strDaily#, #strShift#         
                    </td>
                    <td>&nbsp;</td> 
                    <td valign="top">
                    	<cfif arrayLen(arrTCAppr) GT 0>
                            <cfloop from=1 to=#arrayLen(arrTCAppr)# index="intY">
                                #arrTCAppr[intY]#
                            </cfloop>
                       	<cfelse>
                        	None
                        </cfif>
                    </td>
                    <!---td>&nbsp;</td> 
                    <td nowrap="nowrap" valign="top">
                    	<cfif trim(strECName) NEQ ''>
                            #strECName#<BR />
                            #strECAddr1#<BR />
                            <cfif strECAddr2 NEQ ''>
                                strECAddr2<BR />
                            </cfif>
                            #strECCity#, #strECST#&nbsp;&nbsp;#strECZIP#<BR />
                            #strECPhone#
                       	<cfelse>
                        	None
                        </cfif>
                    </td--->
                </tr>
                <tr>
                    <td colspan=14>&nbsp;</td>
                </tr>
                    <cfset intX += 1>
                </cfloop>
                
            </table>
        <cfelse>
            <span class="error">At the present time, there are not any employees staged for entry to Fundware.</span>
        </cfif>
        
    </cfoutput>
    
    			</div>
    		</div>
    	</div>
    
	</cfdocument>



